$(function() {
		/*************  Initialize Price Range Slider *************/
		$( "#slider-range" ).slider({
			range: true,
			min: 50,
			max: 300,
			step: 10, // Use this determine the amount of each interval
			values: [ 100, 250 ], // The default range
			slide: function( event, ui ) {
				$( "#amount" ).val( "\u20ac" + ui.values[ 0 ] + " - \u20ac" + ui.values[ 1 ] ); // for input text box
				$( "#my_min" ).val(ui.values[ 0 ]); // Display and selected the min Price
				$( "#my_max" ).val(ui.values[ 1 ]); // Display and selected the max Price
			}
		});
		
		/*************  Set Initial Value of the Dropdown Box *************/
		//For dropdown box
		$( "#my_min" ).val($( "#slider-range" ).slider( "values", 0 ));
		$( "#my_max" ).val($( "#slider-range" ).slider( "values", 1 ));
		
		//For input text box
		$( "#amount" ).val( "\u20ac" + $( "#slider-range" ).slider( "values", 0 ) +
			" - \u20ac" + $( "#slider-range" ).slider( "values", 1 ) );
		
		/************* When user choose from dropdown box directly *************/
		$("select.price_range").change(function () {
			$myMinValue = $("#my_min option:selected").val();
			$myMaxValue = $("#my_max option:selected").val();
			//Make changes on the slider itself
			if($myMinValue <= $myMaxValue) {
				$( "#slider-range" ).slider({
					values: [$myMinValue, $myMaxValue]							
				});
			} else {
				alert("Invalid Input");	
			}
		});
		
	});
	
	/* PREZZO INTERVENTO */
	$(function() {
		/*************  Initialize Price Range Slider *************/
		$( "#slider-range1" ).slider({
			range: true,
			min: 100,
			max: 30000,
			step: 5, // Use this determine the amount of each interval
			values: [ 2000, 10000 ], // The default range
			slide: function( event, ui ) {
				$( "#amount1" ).val( "\u20ac" + ui.values[ 0 ] + " - \u20ac" + ui.values[ 1 ] ); // for input text box
				$( "#my_min" ).val(ui.values[ 0 ]); // Display and selected the min Price
				$( "#my_max" ).val(ui.values[ 1 ]); // Display and selected the max Price
			}
		});
		
		/*************  Set Initial Value of the Dropdown Box *************/
		//For dropdown box
		$( "#my_min" ).val($( "#slider-range1" ).slider( "values", 0 ));
		$( "#my_max" ).val($( "#slider-range1" ).slider( "values", 1 ));
		
		//For input text box
		$( "#amount1" ).val( "\u20ac" + $( "#slider-range1" ).slider( "values", 0 ) +
			" - \u20ac" + $( "#slider-range1" ).slider( "values", 1 ) );
		
		/************* When user choose from dropdown box directly *************/
		$("select.price_range").change(function () {
			$myMinValue = $("#my_min option:selected").val();
			$myMaxValue = $("#my_max option:selected").val();
			//Make changes on the slider itself
			if($myMinValue <= $myMaxValue) {
				$( "#slider-range" ).slider({
					values: [$myMinValue, $myMaxValue]							
				});
			} else {
				alert("Invalid Input");	
			}
		});
		
	});
	
	
